package bb.lanxing.util;

import com.github.mikephil.charting.utils.Utils;

import gov.nist.core.Separators;

public class LatLngFormat {
    public static String E = "E";

    public static String N = "N";

    public static String S = "S";

    public static String W = "W";

    public static String formatToLocationString(double latitude, double longitude) {
        String changeToDFM = changeToDFM(latitude);
        String changeToDFM2 = changeToDFM(longitude);
        String str = latitude > Utils.DOUBLE_EPSILON ? N : S;
        String str2 = longitude > Utils.DOUBLE_EPSILON ? E : W;
        return changeToDFM + str + ", " + changeToDFM2 + str2;
    }

    public static String changeToDFM(double du) {
        int i = (int) du;
        double d = (du - i) * 60.0d;
        int i2 = (int) d;
        String format = String.format("%.2f", Math.abs((d - i2) * 60.0d));
        return i + "°" + Math.abs(i2) + Separators.QUOTE + format + "\"";
    }
}